        % fit spline to data
        
        L = isnan(i_data);
        data_array = i_data(~L);
        time_array = time_array_hour(~L);
        
        b1 = min(time_array):365:max(time_array);
        if length(b1) > 1,
            sp=spline(b1,data_array'/spline(b1,eye(length(b1)),time_array'));
            i_spline=ppval(time_array_hour,sp);
            i_spline(L) = NaN;
            
        else,%data length <=1 year
            sp=robustfit(time_array,data_array);
            i_spline= sp(1) + sp(2) * time_array_hour;
            i_spline(L) = NaN;
        end;
        
        % get the stats
        wmm_f = interp1(datenum(2000:0.1:2014.0,0,0), wmm_f, time_array);
        obs(i).i_data_wmm_rms = rms(data_array - wmm_f);
        obs(i).i_spline_wmm_rms = rms(i_spline(~L) - wmm_f);
        obs(i).i_spline_resii_rms = rms(data_array-i_spline(~L));
        
        [p,stats] = robustfit(1:length(data_array), data_array - wmm_f);
        L = stats.w == 0;
        obs(i).i_data_wmm_rms_rob = rms(data_array(~L) - wmm_f(~L));